<?php

namespace app\dao;

use app\model\Title;

class TitleDao extends BaseDao
{
    private $query;

    protected function setModel()
    {
        // TODO: Implement setModel() method.
        return Title::class;
    }

    public function __construct()
    {
        $this->query = new Title();
    }

    public function findByType($type){
        $this->query = $this->query->where('type',$type);
        return $this;
    }

    public function findByTitle($title){
        $this->query = $this->query->where('title',$title);
        return $this;
    }

    public function getOne(){
        return $this->query->find();
    }

    public function getAll(){
        return $this->query->select();
    }

    public function getField($field){
        $this->query = $this->query->field($field);
        return $this;
    }

    public function order(Array $filed){
        $this->query =  $this->query->order($filed);
        return $this;
    }

}